<template>
	<view>
		<view class="detail-item">
			<view class="left">投放时间</view>
			<view class="right">{{detailInfo.throwTime}}</view>
		</view>
		<view class="detail-item">
			<view class="left">记录编号</view>
			<view class="right">{{detailInfo.code}}</view>
		</view>
		<view class="detail-item">
			<view class="left">投放站点</view>
			<view class="right">{{detailInfo.siteName}}</view>
		</view>
		<view class="detail-item">
			<view class="left">可回收垃圾</view>
			<view class="right">{{detailInfo.recyclableWeight | transform}}kg</view>
		</view>
		<view class="detail-item">
			<view class="left">易腐垃圾</view>
			<view class="right">{{detailInfo.perishableWeight | transform}}kg</view>
		</view>
		<view class="detail-item">
			<view class="left">有害垃圾</view>
			<view class="right">{{detailInfo.hazardousWeight | transform}}kg</view>
		</view>
		<view class="detail-item">
			<view class="left">其他垃圾</view>
			<view class="right">{{detailInfo.otherWeight | transform}}kg</view>
		</view>
		<view class="detail-item">
			<view class="left">投放情况</view>
			<view v-if="detailInfo.disposalStatus == 1" class="true">准确</view>
			<view v-else class="wrong">错误</view>
		</view>
		<view class="detail-item">
			<view class="left">分类情况</view>
			<view v-if="detailInfo.classificationStatus	 == 1" class="true">好</view>
			<view v-else-if="detailInfo.classificationStatus == 2" class="common">一般</view>
			<view v-else class="wrong">差</view>
		</view>
		<view class="detail-item">
			<view class="left">投放评分</view>
			<view class="right">+{{detailInfo.points}}</view>
		</view>
		<view class="feedback" @click="goFeedback">意见反馈</view>
	</view>
</template>

<script>
	// import {mapState} from 'vuex'
	import dayjs from 'dayjs'
	export default {
		data() {
			return {
				id: null,
				params: {
					projId: null,
					residentId: null,
					pagination: {
						current: 1,
						pageSize: 10
					},
					sorter: {
						field: "id",
						order: 0
					}
				},
				recordList: [],
				detailInfo: {},
				code: null
			}
		},
		computed: {
			// ...mapState(['userInfo'])
		},
		onLoad(options) {
			this.userInfo = uni.getStorageSync('userInfo')
			this.id = options.id
			this.getReleaseRecord()
		},
		methods: {
			getReleaseRecord() {
				this.params.projId = this.userInfo.projId
				this.params.residentId = this.userInfo.id
				this.$http.post('wx/record/list',this.params).then(res => {
					console.log(res)
					if(res.code === 10000){
						this.recordList = res.data.list
						this.recordList.some(item => {
							if(item.id == this.id){
								item.throwTime = dayjs(item.throwTime).format('YYYY-MM-DD HH:mm:ss')
								this.detailInfo = item
								this.code = item.code
							}
						})
						console.log(this.detailInfo)
					}
				})
			},
			// 跳转意见反馈
			goFeedback() {
				uni.navigateTo({
					url: '../../ticketSystem/feedback/feedback?code=' + this.code
				})
			}
		},
		// onLoad(options){
		// 	console.log(options.id)
		// 	this.id = options.id
		// 	this.getReleaseRecord()
		// },
		filters: {
			transform: function(val) {
				return val !== 0 ? (val / 10000).toFixed(3) : val
			}
		}
	}
</script>

<style lang="scss">
	.detail-item {
		width: 750rpx;
		height: 64rpx;
		padding: 19rpx;
		display: flex;
		justify-content: space-between;
		font-size: 28rpx;
		border-bottom: 1rpx solid #F5F5F5;
		.left {
			color: #888;
		}
		.right {
			color: #555;
		}
		.true {
			color: #43CC46;
		}
		.wrong {
			color: #FB5656;
		}
		.common {
			color: #FFBB66;
		}
	}
	.feedback {
			width: 750rpx;
			height: 98rpx;
			color: #fff;
			text-align: center;
			font-size: 32rpx;
			line-height: 98rpx;
			font-family: Noto Sans S Chinese;
			font-weight: bold;
			background-color: #42ADFF;
			position: absolute;
			bottom: 0;
		}
</style>
